<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateNbbindTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('nb_bind', function (Blueprint $table) {
            $table->increments('id');
            $table->string('verifyCode')->unique();
            $table->integer('room_id')->unsigned();
            $table->string('loc')->nullable();
            $table->integer('type_id')->unsigned();
            $table->integer('agent_id')->unsigned();
            $table->integer('camera_id')->unsigned()->nullable();
            $table->tinyInteger('status')->default(1);
            $table->foreign('room_id')->references('id')->on('room');
            $table->foreign('type_id')->references('id')->on('nb_type');
            $table->foreign('agent_id')->references('id')->on('agent');
            $table->foreign('camera_id')->references('id')->on('camera');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop('nb_bind');
    }
}
